import request from '../utils/request'
// 获取商品分类
export const getCategories = (obj) => request({
    method: 'get',
    url: '/categories',
    params: obj
})
export const getParentCategories = () => request({
    method: 'get',
    url: '/categories',
    params: { type: 2 }
})
export const addCate = (data) => request({
    method: 'POST',
    url: '/categories',
    data
})
export const getParams = (id, obj) => request({
    method: 'GET',
    url: `categories/${id}/attributes`,
    params: {
        sel: obj
    }
})
export const editCate = (id, cat_name) => request({
    method: 'PUT',
    url: `categories/${id}`,
    data: {
        cat_name,
    }
})
export const addParams = (id, data) => request({
    method: 'POST',
    url: `categories/${id}/attributes`,
    data
})
export const editParams = (cateId, id, data) => request({
    method: 'PUT',
    url: `categories/${cateId}/attributes/${id}`,
    data
})
export const deleteParams = (cateId, id) => request({
    method: 'delete',
    url: `categories/${cateId}/attributes/${id}`,
})
export const addTag = (cateId, id, data) => request({
    method: 'PUT',
    url: `categories/${cateId}/attributes/${id}`,
    data
})